<template>
  <view>
    <view class="content">

      <view class="profile">
          <view class="profile-info">
              <img style="width:4.5em;height:4.5em;border-radius:50%;" 
                src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%253A%252F%252Fdingyue.ws.126.net%252F2021%252F0926%252F47f59dc0j00r00u8i000sc000u000u0c.jpg%26thumbnail%3D650x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1658126433&t=b5dbc0efeca75405932bd51692e25546">
               <text style="margin-left:1em;font-weight:800;">{{name}}</text>
               <van-icon style="margin-left:0.5em" @click="changeInfo" dot name="edit" color="#fff" />
          </view>
      </view>
    </view>
     
     


      <van-cell-group inset>
        <van-cell @click="toInfo" is-link title="个人信息" />
        <!-- <van-cell is-link title="我的快诊单" value="内容" label="描述信息" /> -->
      </van-cell-group>

        <view>
          <uni-card title="2021-11-03 120578快诊单">
            <result />
          </uni-card>
          <uni-card title="2021-11-05 162345快诊单">
            <result />
          </uni-card>
        </view>


      <van-tabbar 
  :active=tabActive 
  activeColor="#ff6781"
  >
  <van-tabbar-item   icon="home-o" data-info="index" @click="tabClickHandler($event)">门诊</van-tabbar-item>
  <van-tabbar-item  icon="friends-o">个人</van-tabbar-item>
  <van-tabbar-item   icon="setting-o" data-info="feedback" @click="tabClickHandler($event)">反馈</van-tabbar-item>
  </van-tabbar>
  </view>
</template>

<script>
export default {
  data() {
    return {
      tabActive :1,
      name:'',
    };
  },
  methods: {
    toInfo(){
      uni.navigateTo({
        url:'/pages/information/information',
        success:function(res){
          console.log(res)
        }
      })
    },
    changeInfo(){
      uni.navigateTo({
        url:'/pages/changeInfo/changeInfo',
        success: function(res) {
         console.log(res)
        }
      })
      console.log("已成功点击")
    },
     tabClickHandler(event){
      // console.log(event)
      let page = event.currentTarget.dataset.info 
      let url = `/pages/${page}/${page}`
      uni.switchTab({
        url:url
      })
    },
    bindDateChange: function(e) {
        this.date = e.detail.value
    },
    getDate(type) {
        const date = new Date();
        let year = date.getFullYear();
        let month = date.getMonth() + 1;
        let day = date.getDate();

        if (type === 'start') {
            year = year - 60;
        } else if (type === 'end') {
            year = year + 2;
        }
        month = month > 9 ? month : '0' + month;
        day = day > 9 ? day : '0' + day;
        return `${year}-${month}-${day}`;
  },
  onShow(){
    console.log('我在监听person页面')
      let that = this; 
      uni.getStorage({
        key:'name',
        success:function(res) {
          that.name = res.data
          console.log(that.name)
        }
      })
  }
};
</script>

<style scoped>

.profile {
  background-image:linear-gradient(#ff6781,#e4e4e4);
  height: 400rpx;
  display: flex;
}
.profile-info {
  margin-top: 2.5rem;
  margin-left: 2rem;
  color:white;
  font-size: 1.3rem;
  font-weight: 500;
  display: flex;
  flex-direction: row;
  align-items: center;
}
</style>
	

